package com.mida.dms.knw.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author ：wang xiao le
 * @description：TODO
 * @date ：2021/1/20 16:03
 */
//@Configuration
//@EnableOpenApi
public class DtSwaggerConfig {
    @Bean
    public Docket createRestApi() {
//
//        return new Docket(DocumentationType.SWAGGER_2)
////                .pathMapping("/swagger/*")
//                .apiInfo(apiInfo())
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("com.ats.dt.controller"))
//                .paths(PathSelectors.any())
//                .build();
//        
        
        return new Docket(DocumentationType.OAS_30)
                .useDefaultResponseMessages(false)
                //.globalResponses(HttpMethod.GET, responseMessageList)
                //.globalRequestParameters(globalRequest)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.ats.dt.controller"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("数据元接口文档")
                .description("描述内容")
                .version("1.0")
                .build();
    }
}
